<template>
  <div>
    抢需求
     <el-table
    :data="tableData"
    border
    style="width: 100%">
    <el-table-column
      fixed
      prop="title"
      label="标题"
      width="150">
    </el-table-column>
    <el-table-column
      prop="name"
      label="项目"
      width="120">
    </el-table-column>
    <el-table-column
      prop="descs"
      label="描述"
      width="120">
    </el-table-column>
    <el-table-column
      prop="money"
      label="金额"
      width="120">
    </el-table-column>

    <el-table-column
      fixed="right"
      label="操作"
      width="100">
      <template slot-scope="scope">
        <el-button @click="handleClick(scope.row.code)" type="text" size="small">抢需求</el-button>
 
      </template>
    </el-table-column>
  </el-table>
  </div>
</template>

<script>
export default {
    

    data() {
      return {
        tableData: [],
        userid:localStorage.getItem('userid')
      }
    },
     methods: {
      handleClick(code) {
        this.axios.post('postgrab',{userid:this.userid,code:code})
        .then(res=>{
            alert(res.data.msg)
        })
      },
      getprograb(){
        this.axios.get("getgrabproject")
        .then(res=>{
            this.tableData = res.data.data
        })
      }
    },
    mounted(){
        this.getprograb()
    }

}
</script>

<style>

</style>